import type { StyleProperty } from '../../../components/style_editor/interfaces'
import type { PlatformTypeValue } from '../../../types/interfaces'

/**
 * 状态前缀映射
 */
export interface StatePrefixMap {
  hover: string
  active: string
  focus: string
  disabled: string
}

/**
 * 状态样式映射
 */
export interface StateStyleMap {
  normal?: Record<string, string>
  hover?: Record<string, string>
  active?: Record<string, string>
  focus?: Record<string, string>
  disabled?: Record<string, string>
}

/**
 * 深色模式样式配置
 */
export interface DarkModeStyleConfig extends ElementStyleConfig {}

/**
 * 元素样式配置
 */
export interface ElementStyleConfig {
  enabled?: boolean
  selector: string
  description: string
  darkMode?: boolean
  styles?: StateStyleMap
  darkStyles?: StateStyleMap
  inline?: boolean // 是否内联应用，仅对 normal 样式有效
  condition?: boolean | (() => boolean)
  mergedStyles?: StateStyleMap[]
}

/**
 * 平台样式配置
 */

export interface StyleConfig {
  config: ElementStyleConfig[]
  styles?: string
}
export type PlatformStyleConfig = {
  [hostname in PlatformTypeValue]: StyleConfig
}

/**
 * 元素样式配置
 */
export interface AdjustElementStyleItemConfig {
  property: StyleProperty
  value: string
  updateTime: number
}

export interface AdjustElementMeta {
  id: string
  selector: string
  name: string
  category: string
}

export interface AdjustElementStyleItemMeta {
  id: string
  name: string
  category: string
  updateTime: number
}

export interface AdjustElementStyleConfig extends AdjustElementStyleItemConfig, AdjustElementMeta {
}

export interface AdjustElementStyleGroupConfig {
  [key: string]: {
    meta: AdjustElementStyleItemMeta
    styles: AdjustElementStyleItemConfig[]
  }
}
